package cn.tj212.xiaoyin.core.consts.service.impl;

import cn.tj212.xiaoyin.common.page.TailPage;
import cn.tj212.xiaoyin.core.consts.dao.ConstsCollegeDao;
import cn.tj212.xiaoyin.core.consts.domain.ConstsCollege;
import cn.tj212.xiaoyin.core.consts.service.IConstsCollegeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConstsCollegeServiceImpl implements IConstsCollegeService {

    @Autowired
    private ConstsCollegeDao entityDao;

    @Override
    public ConstsCollege getById(Long id) {
        return entityDao.getById(id);
    }

    @Override
    public ConstsCollege getByCode(String code) {
        return entityDao.getByCode(code);
    }

    @Override
    public List<ConstsCollege> queryAll(ConstsCollege queryEntity) {
        return entityDao.queryAll(queryEntity);
    }

    @Override
    public TailPage<ConstsCollege> queryPage(ConstsCollege queryEntity, TailPage<ConstsCollege> page) {
        Integer itemsTotalCount = entityDao.getTotalItemsCount(queryEntity);
        List<ConstsCollege> items = entityDao.queryPage(queryEntity, page);
        page.setItemsTotalCount(itemsTotalCount);
        page.setItems(items);
        return page;
    }

    @Override
    public void create(ConstsCollege entity) {
        entityDao.create(entity);
    }

    /**
     * 创建网校
     *
     * @param entity
     */
    @Override
    public void createSelectivity(ConstsCollege entity) {
        entityDao.createSelectivity(entity);
    }

    @Override
    public void delete(ConstsCollege entity) {
        entityDao.delete(entity);
    }

    @Override
    public void deleteLogic(ConstsCollege entity) {
        entityDao.deleteLogic(entity);
    }
}
